<?
	require_once("../cBasic/950cons.php");
	$sTable=$_GET['table'];
	$recid=$_GET['recid'];
	$aColumns = array('SkillID','ESRegDate');
	$aColumnsValue=array();
	
	$sQuery="select  SkillID,ESRegDate from $sTable where EmpID=".$recid." and Status=1";
	$rResult = mysql_query( $sQuery, $con ) or die(mysql_error());
	
	while ( $aRow = mysql_fetch_array( $rResult ) )
	{
		$row = array();
		for ( $i=0 ; $i<count($aColumns) ; $i++ )
		{
				/* General output */
				$row[] = $aRow[ $aColumns[$i] ];
		}
		$aColumnsValue[] = $row;
	}
		
	$newcol=array('skCode&Name','ESRegDate');
	$output = array();
	$output['title'] = $newcol;
	$output["aaData"] = array();
	for  ( $i=0 ; $i<count($aColumnsValue) ; $i++ ){
		$sQuery="select skCode, skName from skill where skID='".$aColumnsValue[$i][0]."'";
		$rResult = mysql_query( $sQuery, $con ) or die(mysql_error());
		while ( $aRow = mysql_fetch_array( $rResult ) ){
			$output["aaData"][] = array($aRow['skCode'].'-'.$aRow['skName'],$aColumnsValue[$i][1]);
		}
	}
	
	mysql_close($con);
	
	echo json_encode($output);
?>